package bpm.dao.impl.document;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

import bpm.domain.document.DocumentNote;
/**
 * 
 * @author ZhaoWangLong Jul 26, 2011
 *
 */
public class DocumentNoteBatchPreparedStatementForUpdate implements
		BatchPreparedStatementSetter {
	private List<DocumentNote> notes;
	
	public DocumentNoteBatchPreparedStatementForUpdate(List<DocumentNote> notes){
		this.notes=notes;
	}
	public DocumentNoteBatchPreparedStatementForUpdate(){}
	public int getBatchSize() {
		return notes.size();
	}
	public void setValues(PreparedStatement ps, int i) throws SQLException {
		ps.setString(1, notes.get(i).getDocumentId());
		ps.setString(2, notes.get(i).getFieldKey());
		ps.setString(3, notes.get(i).getValue());
		ps.setString(4, notes.get(i).getAuthorId());
		ps.setString(5, notes.get(i).getAuthorName());
		ps.setString(6, notes.get(i).getDeptId());
		ps.setString(7, notes.get(i).getDeptName());
		ps.setDate(8, new java.sql.Date(notes.get(i).getLastUpdateTime().getTime()));
		ps.setString(9, notes.get(i).getDescription());
		ps.setString(10, notes.get(i).getId());
	}

}
